<?php
class Zend_View_Helper_SearchKeywords {
	
	protected $_view;
	function setView($view) { 
		$this->_view = $view; 
	} 
	
	/**
	 * Get displayable search keywords
	 * @param $searchData search data cached in session
	 */
	function searchKeywords($searchData) {
		$table = new City();
		$countryTable = new Country();
		$ret="";
		if ($searchData[Constant::VAR_SEARCH_DATA_TYPE] == "all" || $searchData[Constant::VAR_SEARCH_DATA_TYPE] == "") {
			$ret.="类型: <strong>全部</strong> ";
		} else if ($searchData[Constant::VAR_SEARCH_DATA_TYPE] == "want" ){
			$ret.="类型: <strong>求托</strong> ";
		} else if($searchData[Constant::VAR_SEARCH_DATA_TYPE] == "lease" ){
			$ret.="类型: <strong>可托</strong> ";
		}
		if ($searchData[Constant::VAR_SEARCH_DATA_FROM_CITY] != 0) {
			$city = $table->findById($searchData[Constant::VAR_SEARCH_DATA_FROM_CITY]); 
			$ret.=(" | 出发城市: <strong>".$city->name_cn."</strong> ");
		} else if ($searchData[Constant::VAR_SEARCH_DATA_FROM_COUNTRY] != 0) {
			$country = $countryTable->findById($searchData[Constant::VAR_SEARCH_DATA_FROM_COUNTRY]);
			$ret.=(" | 出发国家: <strong>".$country->name_cn." 城市不限 </strong>");
		}
		if ($searchData[Constant::VAR_SEARCH_DATA_TO_CITY] != 0) {
			$city = $table->findById($searchData[Constant::VAR_SEARCH_DATA_TO_CITY]); 
			$ret.=(" | 抵达城市: <strong>".$city->name_cn."</strong>  ");
		} else if ($searchData[Constant::VAR_SEARCH_DATA_TO_COUNTRY] != 0) {
			$country = $countryTable->findById($searchData[Constant::VAR_SEARCH_DATA_TO_COUNTRY]);
			$ret.=(" | 抵达国家: <strong>".$country->name_cn." 城市不限 </strong> ");
		}
		if (!empty($searchData[Constant::VAR_SEARCH_DATA_LASTEST_ARRIVAL_DATE])) {
			$ret.=(" | 最晚抵达时间: <strong>".$searchData[Constant::VAR_SEARCH_DATA_LASTEST_ARRIVAL_DATE]."</strong>  ");
		}
		return $ret;
	}
}
?>